package thread_pool;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/5/23
 * Time:14:58
 *  initialValue + set + get
 **/
public class PoolDemo25 {
    static ThreadLocal<String> threadLocal = new ThreadLocal(){
        @Override
        protected Object initialValue() {
            System.out.println("执行了初始化方法");
            return "java";
        }
    };

    public static void main(String[] args) {
        threadLocal.set("Mysql");
        String result = threadLocal.get();
        System.out.println("结果："+result);

    }

}
